package com.qys.livesMall.app.user.model.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.qys.livesMall.app.user.model.enums.UserBalanceLogTypeEnum;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.io.Serial;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;

/**
 * <p>
 * 用户资金变动记录
 * </p>
 *
 * @author dp
 * @since 2023-04-24
 */
@Data
@EqualsAndHashCode(callSuper = false)
@TableName("h2_app_user_balance_log")
@Schema(name = "H2AppUserBalanceLog对象", description = "用户资金变动记录")
public class H2AppUserBalanceLog implements Serializable {

    @Serial
    private static final long serialVersionUID = 1L;

    @TableId("id")
    private String id;

    @Schema(description = "用户Id")
    @TableField("user_id")
    @JsonIgnore
    private Long userId;

    @Schema(description = "用户名")
    @TableField("nick_name")
    private String nickName;

    @Schema(description = "变动说明")
    @TableField("remark")
    private String remark;

    @Schema(description = "变动前金额")
    @TableField("old_amount")
    private BigDecimal oldAmount;

    @Schema(description = "变动金额")
    @TableField("amount")
    private BigDecimal amount;

    @Schema(description = "类型(0支出,1收入)")
    @TableField("status")
    private Byte status;

    @Schema(description = "订单类型（0商城订单,1商城订单退款,2充值）")
    @TableField("type")
    private UserBalanceLogTypeEnum type;

    @Schema(description = "创建时间")
    @TableField("create_time")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+0")
    private LocalDateTime createTime;

    @Schema(description = "创建人")
    @TableField("create_by")
    @JsonIgnore
    private String createBy;


}
